package com.cxb.manager;

import java.util.List;
import android.content.Context;
import android.content.Intent;

import com.cxb.entity.GpsDestinationInfo;
import com.cxb.utils.Constants;
import com.cxb.utils.DBHelp;

public class HistoryManager {
	private DBHelp dbHelp;
	private Context mContext;

	public HistoryManager(Context context) {
		dbHelp = new DBHelp(context);
		mContext = context;
	}

	public void addHistoryList(List<GpsDestinationInfo> list) {
		dbHelp.addHistoryList(list);
	}

	public void addHistory(GpsDestinationInfo destination) {
		dbHelp.addHistory(destination);
		mContext.sendBroadcast(new Intent(
				Constants.CXBBroadcast.HISTORY_REFRESH_ACTION));
	}

	public List<GpsDestinationInfo> getAllHistory() {
		return dbHelp.getAllHistory();
	}

	// public void deleteHistoryById(int id) {
	// dbHelp.deleteHistoryById(id);
	// }
	public void deleteHistoryByName(String address) {
		dbHelp.deleteHistoryByName(address);
	}

	public void deleteHistoryById(int id) {
		dbHelp.deleteHistoryById(id);
	}

	public void deleteAllHistory() {
		dbHelp.deleteAllHistory();
	}

	public int getHistoryTotalCount() {
		return dbHelp.getHistoryTotalCount();
	}

	public GpsDestinationInfo getNextHistory(int currentHistoryId) {
		return dbHelp.getNextHistory(currentHistoryId);
	}

	public GpsDestinationInfo getPreHistory(int currentHistoryId) {
		return dbHelp.getPreHistory(currentHistoryId);
	}
}
